HAL CORTEX migration: List of applicable concepts

This section provides information about the HAL CORTEX applicable concepts .

Concepts for CORTEX

Concept

Description

Unitary configuration APIs

Unitary APIs have been introduced, primarily in the MPU section, to provide finer control over the configuration.

Replaced TypeDef suffix with _t in type names

All TypeDef parts of the HAL CORTEX driver have been removed and replaced by _t.

Replaced nonmodifiable pointers with const keywords

Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable.

Assertion implementation and usage in HAL1

Implement parameter and state checks using assertions to ensure that conditions are met during development and debugging, improving code reliability and maintainability.

Replace the assert_param macro with ASSERT_DBG_PARAM, controlled by the USE_ASSERT_DBG_PARAM conditional.

USE_ASSERT_DBG_PARAM has been introduced as a conditional compilation flag to enable or disable debug parameter assertions, allowing for flexible debugging and validation.

For example: ASSERT_DBG_PARAM(IS_PRIORITY_GROUP(prio_grp))

Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.

Replace finite parameters, such as peripheral instances, with enumerated types at the HAL level to improve type safety, readability, and maintainability.

Other HAL CORTEX changes

ARM Architecture

Concept

Consideration

All

Remove LL CORTEX

Redundant functionality between LL driver and ARM CMSIS core APIs.

All

Add HAL_CORTEX_NVIC_GetPriority() symmetric API with HAL_CORTEX_NVIC_SetPriority()

Introduce a symmetric API to retrieve the priority of an interrupt, complementing the existing API to set the priority, ensuring consistency and completeness in the NVIC API set.

All

Merge systick clock source configuration HAL_CORTEX_SYSTICK_CLKSourceConfig() with global systick enabling HAL_CORTEX_SYSTICK_Config()

Add source clock as parameter to the hal_cortex_systik_clk_src_t enumeration.

All

Replace Ticks_num (expressed in time) by ticks_freq (expressed in frequency).

Update the SysTick configuration to use frequency-based parameters instead of time-based parameters, providing a more intuitive and consistent approach to configuring the SysTick timer.

All

Remove unapplicable ARM cortex attributes within STM32 devices.

Remove shareability attribute, transient attribute and L2 cache configuration.

All

Add APIs to be used in memory protection unit (MPU).

HAL_CORTEX_MPU_IsEnabled() HAL_CORTEX_MPU_IsEnabledRegion()

All

Add getter for CPU ID information(provided within ll_cortex.h in HAL1).

HAL_CORTEX_SCB_GetInfo()

All

Split the MPU region configuration from the enable/disable.

HAL_CORTEX_MPU_EnableRegion(): enables region configuration. HAL_CORTEX_MPU_DisableRegion(): disables region configuration. HAL_CORTEX_MPU_SetConfigRegion(): sets region configuration.

ARMv8-M ARMv7-M

Add  missing APIs in NVIC for IRQ management (provided by core_cm33.h)

HAL_CORTEX_NVIC_IsActiveIRQ() HAL_CORTEX_NVIC_IsEnabledIRQ() HAL_CORTEX_NVIC_IsPendingIRQ()

ARMv8-M

Abstract inner and outer approach.

Simplify the configuration of memory attributes by abstracting the inner and outer approach, making the API more intuitive and easier to use.

ARMv8-M

Split memory attribute API (device configuration vs normal configuration)

Dedicated function for device memory attributes memory:

  • HAL_CORTEX_MPU_SetDeviceMemAttr()

  • HAL_CORTEX_MPU_GetDeviceMemAttr()

Dedicated function for normal memory attributes memory:

  • HAL_CORTEX_MPU_SetCacheMemAttr()

  • HAL_CORTEX_MPU_GetCacheMemAttr()

ARMv8-M ARMv7-M

Add cortex faults exception management

HAL_CORTEX_SCB_EnableHWFaultEscalation() HAL_CORTEX_SCB_DisableHWFaultEscalation()